package cn.java.web.side.transmittable;

import com.alibaba.ttl.TtlRunnable;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo {

    static ExecutorService executorService = Executors.newFixedThreadPool(1);

    public static void main(String[] args) {
        dowithpool(10);
    }

    private static void dowithpool(int time) {
        for(int i=0;i<time;i++){
            Integer var1 = (int)(Math.random()*100);
            Integer var2 = (int)(Math.random()*100);
            ThreadContext.setUserId(var1);
            executorService.execute(TtlRunnable.get(()->assert1(var1,var2)));
        }
    }

    public static void assert1(Integer var1,Integer var2){
        System.out.println(ThreadContext.userId()*var2==var1*var2);
    }
}
